package com.CMS.server.domain;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = EntityTokens.ITEM_TABLE)
public class ItemMenu extends BaseEntity{	

	/**
	 * 
	 */
	private static final long serialVersionUID = 7960980017816604319L;

	public ItemMenu(){
		super();
	}

	@Column(name = EntityTokens.ITEM_ORDEN, nullable = false)
	protected int orden;
	
	@ManyToOne(cascade ={CascadeType.MERGE, CascadeType.REFRESH, CascadeType.REMOVE}, fetch = FetchType.EAGER)
	protected ItemMenu padre;
	
	@ManyToOne(cascade ={CascadeType.MERGE, CascadeType.REFRESH, CascadeType.REMOVE}, fetch = FetchType.EAGER)
	protected Menu menu;

	public Menu getMenu() {
		return menu;
	}

	public void setMenu(Menu menu) {
		this.menu = menu;
	}

	public int getOrden() {
		return orden;
	}

	public void setOrden(int orden) {
		this.orden = orden;
	}

	public ItemMenu getPadre() {
		return padre;
	}

	public void setPadre(ItemMenu padre) {
		this.padre = padre;
	}	
	
}
